<?php

namespace app\home\model;

use think\Model;
use traits\model\SoftDelete;


class Show extends Model
{
    use SoftDelete;

    protected $table = 'order';

    //    展示+只显示未付款的条件查询
    public static function index($word)
    {
        if(empty($word)){
            $data = self::paginate(3);
        }else{
            $data = self::where('o_order_id','like',"%$word%")->paginate(3);
        }

        return $data;

    }

    public static function del($id)
    {

        return self::find($id)->delete();

    }

    //回收站
    public static function recycling($word)
    {
        return self::onlyTrashed()->paginate(3);
        //where('o_order_id','like',"%$word%")->onlyTrashed()->
    }

    //彻底删除
    public static function deletes($id)
    {
        return self::destroy($id, true);
    }

    //数据恢复
    public static function restores($id)
    {
        $obj = new self();
        $obj->restore(['id' => $id]);
    }
}
